import query from '../utils/mysql.mjs'

export default defineEventHandler(async event => {
  // http协议解析框架h3
  // https://github.com/unjs/h3
  // https://www.jsdocs.io/package/h3
  const params = getQuery(event)
  const syl = `select * from customers where id=${params.id}`
  const result = await query(syl)
  if (result.length == 0) {
    console.log('查询数据失败')
  }
  return { code: 0, data: result[0] }
})
